package de.dhbw.karlsruhe.picsim.util.impl;

import de.dhbw.karlsruhe.picsim.model.memory.FileAddress;
import org.jetbrains.annotations.NotNull;

/**
 * Created by IntelliJ IDEA.
 * User: goesen
 * Date: Apr 18, 2010
 * Time: 1:33:23 AM
 */
public final class Addresses {
    private Addresses() {
    }

    public static boolean isGeneralPurposeAddress(@NotNull final FileAddress fileAddress) {
        final int value = BitUtilities.fromLeastSignificantBitFirst(fileAddress.getBits());
        return value > 11 && value < 49 || value > 11 + 0x8f && value < 49 + 0x8f;
    }

    public static boolean isUnimplemented(@NotNull final FileAddress fileAddress) {
        final int value = BitUtilities.fromLeastSignificantBitFirst(fileAddress.getBits()) % 128;
        return value == 7 || value >= 0x30;
    }
}
